<script>

var request = window.indexedDB.deleteDatabase("IndexedDBMultiProcess");
request.onsuccess = function(e)
{
    continueTest();
}
request.onerror = function(e)
{
    // Unexpected error
    window.webkit.messageHandlers.testHandler.postMessage('Error opening database');
}

function continueTest()
{
    var request = window.indexedDB.open("IndexedDBMultiProcess", 2);

    request.onsuccess = function()
    {
        window.webkit.messageHandlers.testHandler.postMessage('Success');
    }

    request.onerror = function()
    {
        // Unexpected error
        window.webkit.messageHandlers.testHandler.postMessage('Error');
    }

    request.onupgradeneeded = function(event)
    {
        window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded');

        var store = event.target.result.createObjectStore("TestObjectStore");

        event.target.transaction.oncomplete = function() {
            window.webkit.messageHandlers.testHandler.postMessage('Transaction complete');
        }

        event.target.transaction.onerror = function() {
            window.webkit.messageHandlers.testHandler.postMessage('Transaction errored!');
        }

        store.put("bar", "foo");
    }
}
</script>
